package org.example.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jingyuwang
 * @date 2020/3/16 下午6:25
 * @description 域名对应的签名
 */
public enum DomainToSignatureEnum {

    LOCAL_HOST("localhost","本地"),
    GXCARDS("gxcards.com","公象网"),
    HVYOGO("hvyogo.com","慧用工"),
    HVCIN("hvcin.com","慧薪"),
    HIQIFU("hiqifu.com","海服"),
    HVYOGO_CN("hvyogo.cn","慧薪"),
    HNHIFU_COM("hnhifu.com","海服科技"),
    HENG_YANG_HIFU_COM("hyhaifu.com","衡阳海服"),
    HVYOGO_NET("hvyogo.net","海服");

    private String domain;
    private String signature;

    DomainToSignatureEnum(String domain, String signature) {
        this.domain = domain;
        this.signature = signature;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public static String getSignatureByDomain(String domain){
        for(DomainToSignatureEnum ds : DomainToSignatureEnum.values()){
            if(ds.getDomain().equals(domain)){
                return ds.getSignature();
            }
        }
       return HVYOGO.getSignature();
    }

    public static List<String> domainList(){
        List<String> domainList = new ArrayList<>();
        for(DomainToSignatureEnum ds : DomainToSignatureEnum.values()){
            domainList.add(ds.getDomain());
        }
        return domainList;
    }
}
